﻿using System;
using System.IO.Ports;

namespace Communication.Channel.Serial
{
	// Token: 0x02000018 RID: 24
	internal class DefaultSerialChannelConfig : DefaultChannelConfig, SerialChannelConfig, ChannelConfig
	{
		// Token: 0x060000F9 RID: 249 RVA: 0x0000328F File Offset: 0x0000148F
		public void SetBaudRate(int baudRate)
		{
			this.baudRate = baudRate;
		}

		// Token: 0x060000FA RID: 250 RVA: 0x00003298 File Offset: 0x00001498
		public int GetBaudRate()
		{
			return this.baudRate;
		}

		// Token: 0x060000FB RID: 251 RVA: 0x000032A0 File Offset: 0x000014A0
		public void SetDataBits(int dataBits)
		{
			this.dataBits = dataBits;
		}

		// Token: 0x060000FC RID: 252 RVA: 0x000032A9 File Offset: 0x000014A9
		public int GetDataBits()
		{
			return this.dataBits;
		}

		// Token: 0x060000FD RID: 253 RVA: 0x000032B1 File Offset: 0x000014B1
		public void SetStopBits(StopBits stopBits)
		{
			this.stopBits = stopBits;
		}

		// Token: 0x060000FE RID: 254 RVA: 0x000032BA File Offset: 0x000014BA
		public StopBits GetStopBits()
		{
			return this.stopBits;
		}

		// Token: 0x060000FF RID: 255 RVA: 0x000032C2 File Offset: 0x000014C2
		public void SetParity(Parity parity)
		{
			this.parity = parity;
		}

		// Token: 0x06000100 RID: 256 RVA: 0x000032CB File Offset: 0x000014CB
		public Parity GetParity()
		{
			return this.parity;
		}

		// Token: 0x06000101 RID: 257 RVA: 0x000032D3 File Offset: 0x000014D3
		public void SetReadTimeoutMillis(int readTimeoutMillis)
		{
			this.readTimeoutMillis = readTimeoutMillis;
		}

		// Token: 0x06000102 RID: 258 RVA: 0x000032DC File Offset: 0x000014DC
		public int GetReadTimeoutMillis()
		{
			return this.readTimeoutMillis;
		}

		// Token: 0x06000103 RID: 259 RVA: 0x000032E4 File Offset: 0x000014E4
		public void SetWriteTimeoutMillis(int writeTimeoutMillis)
		{
			this.writeTimeoutMillis = writeTimeoutMillis;
		}

		// Token: 0x06000104 RID: 260 RVA: 0x000032ED File Offset: 0x000014ED
		public int GetWriteTimeoutMillis()
		{
			return this.writeTimeoutMillis;
		}

		// Token: 0x06000105 RID: 261 RVA: 0x000032F5 File Offset: 0x000014F5
		public void SetReadBufferSize(int readBufferSize)
		{
			this.readBufferSize = readBufferSize;
		}

		// Token: 0x06000106 RID: 262 RVA: 0x000032FE File Offset: 0x000014FE
		public int GetReadBufferSize()
		{
			return this.readBufferSize;
		}

		// Token: 0x06000107 RID: 263 RVA: 0x00003306 File Offset: 0x00001506
		public void SetWriteBufferSize(int writeBufferSize)
		{
			this.writeBufferSize = writeBufferSize;
		}

		// Token: 0x06000108 RID: 264 RVA: 0x0000330F File Offset: 0x0000150F
		public int GetWriteBufferSize()
		{
			return this.writeBufferSize;
		}

		public override bool SetOption(string name, object value)
		{
			if (!base.SetOption(name, value))
			{
				switch (name)
				{
				case "baudRate":
					this.SetBaudRate((int)value);
					return true;
				case "dataBits":
					this.SetDataBits((int)value);
					return true;
				case "stopBits":
					this.SetStopBits((StopBits)value);
					return true;
				case "parity":
					this.SetParity((Parity)value);
					return true;
				case "readTimeoutMillis":
					this.SetReadTimeoutMillis((int)value);
					return true;
				case "writeTimeoutMillis":
					this.SetWriteTimeoutMillis((int)value);
					return true;
				case "readBufferSize":
					this.SetReadBufferSize((int)value);
					return true;
				case "writeBufferSize":
					this.SetWriteBufferSize((int)value);
					return true;
				}
				return false;
			}
			return true;
		}

		// Token: 0x0400001A RID: 26
		private int baudRate = 9600;

		// Token: 0x0400001B RID: 27
		private int dataBits = 8;

		// Token: 0x0400001C RID: 28
		private StopBits stopBits = StopBits.One;

		// Token: 0x0400001D RID: 29
		private Parity parity;

		// Token: 0x0400001E RID: 30
		private int readTimeoutMillis = 50;

		// Token: 0x0400001F RID: 31
		private int writeTimeoutMillis = 50;

		// Token: 0x04000020 RID: 32
		private int readBufferSize = 8192;

		// Token: 0x04000021 RID: 33
		private int writeBufferSize = 1024;
	}
}
